<?php
namespace pgc;
use \hc\tpl;
use \hc\session;
use \hc\js;
class UserGps extends tpl{
	public function __construct(){
		parent::__construct();
		session::init();
    if(isset($_SESSION['pgcinfo'])){
        $this->pgcinfo=$_SESSION['pgcinfo'];
    }else{
        $url=MODEL_URL."/Login/index.html";
       echo 	js::to_url($url);exit;
    }
    $this->userGps_m=new \model\userGps_m;
	}
	public function index(){
		$data=$this->userGps_m->s_all();
		$data=json_encode($data);
    $this->assign('listarr',$data);
		$baidukey=C('baidukey');
		$this->assign('baidukey',$baidukey);
    $this->display('userGps/lists.tpl');
	}
	public function index2(){
    $data=$this->userGps_m->s_all_ajaxs();
    if(isset($_POST['ajaxs'])){
        ajax_return(true,'',$data);
    }
    $this->assign('listarr',$data['list']);
    $this->assign('pageshow',$data['pageshow']);
    $this->display('userGps/lists2.tpl');
	}
	//根据经度信息和纬度信息
	public function gpsMap2(){
			if(isset($_GET['longitude']) && isset($_GET['latitude'])){
				$baidukey=C('baidukey');
				$this->assign('baidukey',$baidukey);
				$this->assign('longitude',$_GET['longitude']);
				$this->assign('latitude',$_GET['latitude']);
				$this->display('usergps/gpsmap2.tpl');
			}
	}

}
?>
